package org.grow.mpgo.controller;

import org.grow.mpgo.dao.PersonDao;
import org.grow.mpgo.entity.PageAbout;
import org.grow.mpgo.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: xwg
 * @CreateDate: 21-7-12
 */

@RestController
public class PersonController {

    @Autowired
    private PersonDao personDao;
    @PostMapping("/person")
    public Person insert(@RequestBody Person person){
        personDao.insert(person);
        return person;
    }

    @PostMapping("/queryPersons")
    public List<Person> queryPersons(@RequestBody PageAbout pageAbout){
        List<Person> query = personDao.query(pageAbout.getPageNum(), pageAbout.getPageSize());
        return query;
    }

//    push pull 之前一定要保证工作区白色 要么commit 要么revert扔掉

}
